import React, {Component} from 'react';
import './index.less';
import {render, bindAction, bindModel} from 'react-division';
import Model from './Model';
import Action from './Action';
import {Button, Space} from 'antd';

bindModel({
    operatorM: Model
});
bindAction({
    operatorA: Action
});


export default render({
    models: ['operatorM'],
    actions: ['operatorA']
})(class OperationBar extends Component {
    constructor(props) {
        super(props);
    }

    render() {
        const {action} = this.props;

        return (
            <div className="operation-bar">
                <Space>
                    <Button 
                        type="primary"
                        onClick={action.operatorA.toPage('list')}
                    >
                        列表
                    </Button>
                    <Button
                        type="primary"
                        onClick={action.operatorA.toPage('edit')}
                    >
                        新建
                    </Button>
                </Space>
            </div>
        );
    }
});